;---------------------------------------------------------------------------
;Fygar Stand Summon (Entrance)
[Statedef 7000]
type    = S
movetype= I
physics = N
velset = 0,0
ctrl = 0
anim = 7000
sprpriority = 3

[State 7000, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7000, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7000, 3]
type = Null
trigger1 = !Time
var(7) = -50-(50*(root,Var(0) > 0))

[State 7000, 4]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7000, 5]
type = HitOverride
trigger1 = 1
attr = SCA,AA,AP
stateno = 7030
time = -1

[State 7000, 6]
type = HitBy
trigger1 = 1
value = SCA,AA,AP
time = -1

[State 7000, 7]
type = PosSet
trigger1 = !Time
x = root,Pos X + ((18*(FrontEdgeDist > 18))*Facing)
y = 0

[State 7000, 8]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7000, 9]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7000, 10]
type = PlaySnd
trigger1 = !Time
value = S1150,0

[State 7000, 11]
type = ChangeState
trigger1 = !AnimTime
value = 7001

;---------------------------------------------------------------------------
;Fygar Stand Summon (Flame Breathe)
[Statedef 7001]
type    = S
movetype= I
physics = S
velset = 0,0
ctrl = 0
anim = 7001
sprpriority = 3

[State 7000, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7000, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7001, 1]
type = Helper
trigger1 = AnimElem = 5
name = "Flame"
ID = 7050
stateno = 7002
pos = ceil(15*const(size.xscale)),ceil(-24*const(size.yscale))
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 7001, 2]
type = ParentVarAdd
trigger1 = AnimElem = 5
var(39) = 1

[State 7001, 3]
type = VarAdd
trigger1 = AnimElem = 5
var(11) = 1

[State 7001, 4]
type = PlaySnd
trigger1 = AnimElem = 5
value = S7000,0

[State 7001, 5]
type = HitOverride
trigger1 = 1
attr = SCA,AA,AP
stateno = 7030
time = -1

[State 7001, 6]
type = HitBy
trigger1 = 1
value = SCA,AA,AP
time = -1

[State 7001, 7]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7001, 8]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7001, 9]
type = ChangeState
trigger1 = !AnimTime
value = 7020

;---------------------------------------------------------------------------
;Fygar Stand Summon (Flame Breathe)
[Statedef 7002]
type    = S
movetype= A
physics = S
velset = 0,0
ctrl = 0
anim = 7002
sprpriority = 3

[State 7002, 1]
type = HitDef
trigger1 = root,Var(5) < 10 && !Time
attr = S, SP
damage = ceil(85*root,fvar(21)),15
animtype = Hard
getpower = 0
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 1,1
sparkno = -1
hitsound = F5,3
guardsound = F6, 0
ground.type = High
guard.slidetime = 26
ground.slidetime = 28
guard.hittime  = 26
ground.hittime  = 28
ground.velocity = -.6*const(size.xscale),-9.5*const(size.yscale)
guard.velocity = -5.6*const(size.xscale)
ground.cornerpush.veloff = 0
air.type = High
air.velocity = -5.6*const(size.xscale),-3.1*const(size.yscale)
air.hittime = 100
yaccel = .35*const(size.yscale)
fall = 1
fall.recover = 0
id = 7000
chainID = -1
nochainID = -1
hitonce = 0
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 7002, 2]
type = Null
triggerall = NumTarget && MoveHit && HitPauseTime = 1
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)
ignorehitpause = 1
persistent = 0

[State 7002, 3]
type = TargetState
trigger1 = NumTarget && MoveHit
trigger1 = HitPauseTime = 1
value = 5400
ID = -1
ignorehitpause = 1

[State 7002, 4]
type = ChangeAnim
trigger1 = !AnimTime
value = 1

[State 7001, 5]
type = ParentVarAdd
trigger1 = Anim = 1
var(10) = 1
persistent = 0

[State 7001, 6]
type = StateTypeSet
trigger1 = Anim = 1
movetype = I        ;I,A,H

[State 7001, 7]
type = DestroySelf
triggerall = parent,Var(10)
trigger1 = !NumTarget && Anim = 1
trigger2 = NumTarget && Anim = 1
trigger2 = target,StateType = L

;---------------------------------------------------------------------------
;Fygar Stand Summon (Entrance)
[Statedef 7010]
type    = A
movetype= I
physics = N
velset = 1.63*const(size.xscale)
ctrl = 0
anim = 7010
sprpriority = 3

[State 7010, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7010, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7010, 3]
type = Null
trigger1 = !Time
var(7) = -50-(50*(root,Var(0) > 0))

[State 7010, 4]
type = PlaySnd
trigger1 = !Time
value = S7010,0
channel = 5
loop = 1

[State 7010, 5]
type = PosSet
trigger1 = !Time
y = -70*const(size.yscale)

[State 7010, 6]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7010, 7]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7030
time = -1

[State 7010, 8]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7010, 9]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7010, 10]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7010, 11]
type = ChangeState
trigger1 = P2Dist X = [-10,10]
value = 7011

;---------------------------------------------------------------------------
;Fygar Crouch Summon (Stomp)
[Statedef 7011]
type    = A
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 7011
sprpriority = 3

[State 7011, 1]
type = VelSet
trigger1 = !Time
y = -5.3*const(size.yscale)

[State 7011, 2]
type = VelAdd
trigger1 = Time <= 10
y = .55*const(size.yscale)

[State 7011, 3]
type = VelSet
trigger1 = AnimElem = 2
y = 9.5*const(size.yscale)

[State 7011, 4]
type = HitDef
trigger1 = root,var(5) < 10 && !Time
attr = S, SA
damage = ceil(150*root,fvar(21)), 38
animtype = Hard
guardflag = H
hitflag = MAF
priority = 4, Hit
pausetime = 12,12
sparkno = S6001
sparkxy = 0, 0
hitsound = F5, 4
guardsound = F6, 0
ground.type = Low
guard.slidetime = 26
ground.slidetime = 28
guard.hittime  = 26
ground.hittime  = 28
ground.velocity = 0,15*const(size.yscale)
guard.velocity = -6*const(size.xscale)
air.type = High
air.velocity = 0,15*const(size.yscale)
yaccel = .35*const(size.yscale)
air.hittime = 12
fall = 1
fall.recover = 0
air.fall = 1
numhits = 1

[State 7011, 5]
type = Null
triggerall = NumTarget && MoveHit && HitPauseTime = 1
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)
ignorehitpause = 1
persistent = 0

[State 7011, 6]
type = PlaySnd
trigger1 = AnimElem = 1
value = S1000,1

[State 7011, 7]
type = StopSnd
trigger1 = !Time
channel = 5

[State 7011, 8]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7030
time = -1

[State 7011, 9]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7011, 10]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7011, 11]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7011, 12]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= -3
value = 7012

;---------------------------------------------------------------------------
;Fygar Crouch Summon (Miss)
[Statedef 7012]
type    = S
movetype= I
physics = S
velset = 0,0
ctrl = 0
anim = 7012
sprpriority = 3

[State 7012, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 7012, 2]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7030
time = -1

[State 7012, 3]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7000, 8]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7000, 9]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7012, 4]
type = ChangeState
trigger1 = !AnimTime
value = 7020 

;---------------------------------------------------------------------------
;Fygar Leave
[Statedef 7020]
type    = S
movetype= I
physics = N
velset = -5.04*const(size.xscale)
ctrl = 0
anim = 7020
sprpriority = 3

[State 7020, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7020, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7020, 3]
type = Turn
trigger1 = !Time

[State 7020, 4]
type = ChangeState
trigger1 = FrontEdgeDist < -30
value = 7300

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 7030]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
anim = 7030
sprpriority = 3

[State 7030, 1]
type = PlaySnd
trigger1 = !Time
value = S4000,2;S7030,0

[State 7030, 2]
type = ParentVarAdd
trigger1 = !Time 
var(6) = -100
ignorehitpause = 1

[State 7030, 3]
type = ChangeState
trigger1 = !AnimTime
value = 7031

[State 7030, 4]
type = ChangeState
trigger1 = root,Var(6) = 0
value = 7040

;---------------------------------------------------------------------------
;Fygar Leave
[Statedef 7031]
type    = S
movetype= I
physics = N
velset = -5.04*const(size.xscale)
ctrl = 0
anim = 7010
sprpriority = 3

[State 7031, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7031, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7031, 3]
type = PlaySnd
triggerall = PrevStateNo = 7030
trigger1 = !Time
value = S7010,0
channel = 5
loop = 1

[State 7031, 4]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1

[State 7031, 5]
type = ChangeState
trigger1 = BackEdgeDist < -30
value = 7032

;---------------------------------------------------------------------------
;Fygar Leave
[Statedef 7032]
type    = S
movetype= I
physics = N
velset = 0
ctrl = 0
anim = 1
sprpriority = 3

[State 7031, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7031, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7032, 3]
type = StopSnd
trigger1 = !Time
channel = 5

[State 7031, 4]
type = ChangeState
trigger1 = Time = 1
value = 7300

;---------------------------------------------------------------------------
;Fygar Defeated
[Statedef 7040]
type    = L
movetype= H
physics = N
sprpriority = 3
velset = 0,0
anim = 7040
ctrl = 0

[State 7040, 1]
type = PlaySnd
trigger1 = !Time
value = S7040,0
channel = 10

[State 7040, 2]
type = ChangeState
trigger1 = !AnimTime 
value = 7031

;---------------------------------------------------------------------------
;Mappy Stand Summon (Entrance)
[Statedef 7100]
type    = A
movetype= I
physics = N
velset = (ParentDist X)/15,-3.33
ctrl = 0
anim = 7100
sprpriority = 3

[State 7100, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7100, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7100, 3]
type = Null
trigger1 = !Time
var(7) = -100-(50*(root,Var(0) > 0))

[State 7100, 4]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7100, 5]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7100, 6]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7130
time = -1

[State 7100, 7]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7100, 8]
type = PlaySnd
trigger1 = !Time
value = S7100,0

[State 7000, 9]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7000, 10]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7100, 11]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7101

;---------------------------------------------------------------------------
;Mappy Stand Summon (Door Summon)
[Statedef 7101]
type    = S
movetype= I
physics = S
velset = 0,0
ctrl = 0
anim = 7101
sprpriority = 3

[State 7101, 1]
type = Helper
trigger1 = !Time
name = "Door"
ID = 7100
stateno = 7102
pos = ceil(27*const(size.xscale)),0
postype = p1
facing = 1
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 7101, 2]
type = ParentVarAdd
trigger1 = AnimElem = 4
var(39) = 1

[State 7101, 3]
type = VarAdd
trigger1 = AnimElem = 4
var(11) = 1

[State 7101, 4]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7130
time = -1

[State 7101, 5]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7105, 6]
type = PlayerPush
trigger1 = 1 
value = 0

[State 7105, 7]
type = ScreenBound
trigger1 = 1 
value = 0

[State 7101, 8]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7101, 9]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7101, 10]
type = PosSet
trigger1 = !Time
y = 0
[State 7101, 11]
type = PlaySnd
trigger1 = AnimElem = 4
value = S7101,1

[State 7101, 12]
type = ChangeState
trigger1 = !AnimTime
value = 7120 + 30*(RoundState != 2)

;---------------------------------------------------------------------------
;Door
[Statedef 7102]
type    = S
movetype= A
physics = S
velset = 0,0
ctrl = 0
anim = 7102
sprpriority = 3

[State 7102, 1]
type = Helper
trigger1 = AnimElem = 5
name = "Wave"
ID = 7050
stateno = 7103
pos = ceil(48*const(size.xscale)),ceil(-27*const(size.yscale))
postype = p1
facing = 1
ownpal = 1

[State 7105, 2]
type = PlayerPush
trigger1 = 1 
value = 0

[State 7105, 3]
type = ScreenBound
trigger1 = 1 
value = 0

[State 7105, 4]
type = PlaySnd
trigger1 = AnimElem = 4
value = S7101,0

[State 7105, 5]
type = ChangeAnim
trigger1 = Anim = 7102 && !AnimTime
value = 1

[State 7001, 8]
type = ParentVarAdd
trigger1 = Anim = 1 && !NumHelper(7050)
var(10) = 1

[State 7102, 6]
type = DestroySelf
trigger1 = parent,Var(10)

;---------------------------------------------------------------------------
;Wave
[Statedef 7103]
type    = A
movetype= A
physics = N
velset = 4.8*const(size.xscale),0
ctrl = 0
anim = 7103
sprpriority = 3

[State 7103, 1]
type = VarSet
trigger1 = !Time
fvar(3) = root,FVar(21)

[State 7103, 2]
type = HitDef
trigger1 = root,var(5) < 10 && !Time
attr = S, HP
damage = 0,25
animtype = Hard
guardflag = MA
hitflag = MAF
getpower = 0,0
priority = 1, Miss
pausetime = 1,1
sparkno = -1
hitsound = -1
guardsound = F6, 0
ground.type = High
ground.slidetime = 11
ground.hittime  = 28
guard.hittime  = 10
ground.velocity = -6.2*const(size.xscale)
ground.cornerpush.veloff = 0
air.type = High
air.velocity = -5*const(size.xscale),-3*const(size.yscale)
yaccel = .35*const(size.yscale)
air.hittime = 15
id = 7010
chainID = -1
nochainID = -1
hitonce = 0
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 7103, 3]
type = Null
triggerall = NumTarget && MoveHit
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)
ignorehitpause = 1
persistent = 0

[State 7103, 4]
type = TargetState
triggerall = NumTarget && MoveHit
trigger1 = HitPauseTime = 1
value = 7105
ignorehitpause = 1

[State 7103, 5]
type = TargetState
triggerall = NumTarget
trigger1 = target,StateNo = 7105 && FrontEdgeDist < 6
value = 7106
ignorehitpause = 1

[State 7103, 6]
type = TargetFacing
triggerall = NumTarget
trigger1 = Facing = target,Facing
value = target,Facing * -1
ID = -1

[State 7103, 7]
type = TargetBind
triggerall = NumTarget
trigger1 = target,StateNo = 7105
time = 1
pos = (target,Pos X - Pos X)*Facing,target,Pos Y - Pos Y
ignorehitpause = 1

[State 7103, 8]
type = TargetLifeAdd
triggerall = NumTarget
trigger1 = target,StateNo = 7106
value = ceil(-100*FVar(3))
ID = -1
kill = 1
persistent = 0

[State 7103, 9]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7103, 10]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7103, 11]
type = PlayerPush
trigger1 = 1 
value = 0

[State 7103, 12]
type = ScreenBound
trigger1 = 1 
value = 0

[State 7103, 13]
type = PlaySnd
trigger1 = Time % 79 = 0 && Time
value = S7101,1
ignorehitpause = 1

[State 7103, 14]
type = ChangeState
trigger1 = FrontEdgeDist < -64
value = 7104

;---------------------------------------------------------------------------
;Wave Over
[Statedef 7104]
type    = A
movetype= A
physics = N
velset = 0,0 ;6.06
ctrl = 0
anim = 1
sprpriority = 3

[State 7104, 1]
type = PosAdd
trigger1 = !Time 
x = 64

[State 7104, 2]
type = Explod
trigger1 = NumTarget && !Time
anim = 7104
ID = 7100
pos = 0,0
postype = p1
facing = 1*Facing
vfacing = 1
bindtime = 1
vel = -6.06*const(size.xscale),0
removetime = -1
scale = const(size.xscale),const(size.yscale)
sprpriority = 3
ontop = 0
ownpal = 1

[State 7104, 2]
type = Null
trigger1 = NumTarget && !Time
x = -6.06*Facing

[State 7104, 2]
type = Null
trigger1 = !Time
channel = 5

[State 7104, 3]
type = Turn
trigger1 = Facing = -1 && !Time

[State 7104, 4]
type = DestroySelf
trigger1 = Time = 1
;---------------------------------------------------------------------------
;Dragged By Wave
[Statedef 7105]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = -2

[State 7105, 1]
type = ChangeAnim2
trigger1 = !Time
value = 7105

[State 7105, 2]
type = PlayerPush
trigger1 = 1 
value = 0

[State 7105, 3]
type = ScreenBound
trigger1 = 1 
value = 0

;---------------------------------------------------------------------------
;Smashed Into Wall
[Statedef 7106]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = -2

[State 7106, 1]
type = ChangeAnim2
trigger1 = !Time
value = 7106

[State 7106, 2]
type = PlayerPush
trigger1 = 1 
value = 0

[State 7106, 3]
type = NotHitBy
trigger1 = 1
value = SCA,AA,AP,AT
time = 1

[State 7106, 4]
type = VelAdd
trigger1 = Time > 8
y = .3

[State 7106, 5]
type = VelSet
trigger1 = AnimElem = 8
x = 1.2
y = -3.3 

[State 7106, 6]
type = EnvShake
trigger1 = AnimElem = 6
time = 18
freq = 90
ampl = -15

[State 7106, 7]
type = PlaySnd
trigger1 = !Time
value = F7,2

[State 7106, 8]
type = SelfState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y && Time > 10
value = 5100

;---------------------------------------------------------------------------
;Mappy Crouch Summon (Entrance)
[Statedef 7110]
type    = A
movetype= I
physics = N
velset = (ParentDist X)/15,-3.33
ctrl = 0
anim = 7110
sprpriority = 3

[State 7110, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7110, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7110, 3]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7110, 4]
type = Null
trigger1 = !Time
var(7) = -100-(50*(root,Var(0) > 0))

[State 7110, 5]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7110, 6]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7130
time = -1

[State 7110, 7]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7100, 8]
type = PlaySnd
trigger1 = !Time
value = S7100,0

[State 7000, 9]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7000, 10]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7110, 11]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7111

;---------------------------------------------------------------------------
;Mappy Crouch Summon (Toss)
[Statedef 7111]
type    = S
movetype= I
physics = N
velset = 0,0
ctrl = 0
anim = 7111
sprpriority = 3

[State 7111, 1]
type = VelSet
trigger1 = AnimElem = 4
x = -2.2*const(size.xscale)
y = -3.64*const(size.yscale)

[State 7111, 2]
type = VelAdd
trigger1 = Time > 13
y = .44

[State 7111, 3]
type = ScreenBound
trigger1 = 1
value = 0

[State 7111, 4]
type = PlayerPush
trigger1 = 1
value = 0

[State 7111, 5]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7130
time = -1

[State 7111, 6]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7111, 7]
type = Helper
trigger1 = AnimElem = 4
name = "Trampoline"
ID = 7050
stateno = 7113
pos = ceil(-5*const(size.xscale)),ceil(-36*const(size.yscale))
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 7111, 8]
type = ParentVarAdd
trigger1 = AnimElem = 4
var(39) = 1

[State 7111, 9]
type = VarAdd
trigger1 = AnimElem = 4
var(11) = 1

[State 7111, 10]
type = StateTypeSet
trigger1 = AnimElem = 4
statetype = A

[State 7111, 11]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7111, 12]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7111, 13]
type = PosSet
trigger1 = !Time
y = 0

[State 7111, 14]
type = PlaySnd
trigger1 = AnimElem = 4
value = S7111,0

[State 7111, 15]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y && Time > 13
value = 7112

;---------------------------------------------------------------------------
;Mappy Crouch Summon (Land)
[Statedef 7112]
type    = S
movetype= I
physics = N
velset = 0,0
ctrl = 0
anim = 7112
sprpriority = 3

[State 7112, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7112, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7112, 3]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7130
time = -1

[State 7112, 4]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7112, 5]
type = PosSet
trigger1 = !Time
y = 0

[State 7112, 13]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7112, 14]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y

[State 7112, 15]
type = ChangeState
trigger1 = !AnimTime
value = 7120 + 30*(RoundState != 2)

;---------------------------------------------------------------------------
;Trampoline (Thrown)
[Statedef 7113]
type    = A
movetype= I
physics = N
velset = Cond(FrontEdgeDist < 80,Cond(P2Dist X < 0, (FrontEdgeDist)/20,(P2Dist X)/20),4.2),-3.6*const(size.yscale)
ctrl = 0
anim = 7113
sprpriority = 3

[State 7113, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7113, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7113, 3]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7113, 4]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7114

;---------------------------------------------------------------------------
;Trampoline
[Statedef 7114]
type    = S
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 7114
sprpriority = 3

[State 7114, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7114, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7114, 3]
type = PosSet
trigger1 = !Time
y = 0

[State 7114, 5]
type = HitDef
trigger1 = root,Var(5) < 10
attr = S,HP
hitflag = MA;FD
guardflag = L
getpower = 0,0
animtype = Hard
priority = 4,Hit
getpower = 0,0
pausetime = 1,1
damage = 0,0
sparkno = -1
sparkxy = -1,-1*floor(const(size.yscale))
hitsound = -1
guardsound = F6,0
ground.type = High
ground.slidetime = 15
ground.hittime  = 15
ground.velocity = 0
guard.velocity = -7*const(size.xscale)
ground.cornerpush.veloff = 0
air.velocity = 0,0
guard.dist = 0
id = 7110
chainID = -1
nochainID = -1
p1stateno = 7115
p2stateno = 7116

[State 7114, 6]
type = Null
triggerall = NumTarget && MoveHit
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)
ignorehitpause = 1
persistent = 0

[State 7114, 7]
type = StateTypeSet
trigger1 = MoveGuarded
trigger2 = Anim = 7114 && !AnimTime
movetype = I

[State 7001, 8]
type = ParentVarAdd
trigger1 =  Anim = 7114 && !AnimTime
var(10) = 1

[State 1002, 9]
type = ChangeAnim
trigger1 = Anim = 7114 && !AnimTime
value = 1

[State 7114, 10]
type = DestroySelf
trigger1 = Anim = 1 && parent,Var(10)

;---------------------------------------------------------------------------
;Trampoline (SPROING)
[Statedef 7115]
type    = S
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 7115
sprpriority = 3

[State 7115, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7115, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7115, 3]
type = TargetBind
triggerall = !NumTarget
trigger1 = !Time
pos = 0,2*const(size.yscale)

[State 7115, 4]
type = TargetBind
triggerall = !NumTarget
trigger1 = Time > 0 && Time < 4
pos = 0,(target,Pos Y) + 2

[State 7115, 5]
type = TargetBind
triggerall = !NumTarget
trigger1 = Time > 0 && Time < 4
pos = 0,(target,Pos Y) + 2*const(size.yscale)

[State 7115, 6]
type = TargetBind
triggerall = !NumTarget
trigger1 = Time >= 4 && Time < 8
pos = 0,(target,Pos Y) - 2*const(size.yscale)

[State 7115, 7]
type = TargetState
triggerall = NumTarget
trigger1 = Time = 8
value = 7117

[State 7115, 8]
type = PlaySnd
trigger1 = AnimElem = 1
value = S40,0

[State 7001, 8]
type = ParentVarAdd
trigger1 = !AnimTime
var(10) = 1

[State 1002, 2]
type = ChangeAnim
trigger1 = !AnimTime
value = 1

[State 1002, 4]
type = DestroySelf
triggerall = parent,Var(10)
trigger1 = !NumTarget && Anim = 1
trigger2 = NumTarget && Anim = 1
trigger2 = target,StateType = L

;---------------------------------------------------------------------------
;P2 caught on trampoline
[Statedef 7116]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = 3

[State 7116, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7116, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7116, 3]
type = ChangeAnim
trigger1 = !Time
value = 5030

;---------------------------------------------------------------------------
;P2 launched
[Statedef 7117]
type    = A
movetype= H
physics = N
velset = 0,-10.2
ctrl = 0
sprpriority = 3

[State 7117, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7117, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7116, 3]
type = ChangeAnim
trigger1 = !Time
value = 5051

[State 0, SelfState]
type = SelfState
trigger1 = Time = 1
value = 5050

;---------------------------------------------------------------------------
;Mappy Leave
[Statedef 7120]
type    = S
movetype= I
physics = N
ctrl = 0
anim = 7120
sprpriority = 3

[State 7120, 1]
type = Turn
trigger1 = !Time

[State 7120, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7120, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7120, 4]
type = VelSet
trigger1 = !Time
x = 2.56*const(size.xscale)

[State 7120, 5]
type = NotHitBy
trigger1 = 1
value = SCA
time = -1

[State 7120, 6]
type = ChangeState
trigger1 = FrontEdgeDist < -30
value = 7300

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 7130]
type    = U
movetype= H
physics = N
ctrl = 0
anim = 7130
velset = 0,0

[State 7130, 1]
type = ParentVarAdd
trigger1 = !Time 
var(6) =  -100
ignorehitpause = 1

[State 7130, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7130, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7130, 4]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 7130, 5]
type = PlaySnd
trigger1 = !Time
value = S7130,0

[State 7130, 6]
type = ChangeState
trigger1 = !AnimTime
value = 7131 + !(StateType != A)

[State 7130, 7]
type = ChangeState
trigger1 = root,Var(6) = 0
value = 7140

;---------------------------------------------------------------------------
; HIT_LAND
[Statedef 7131]
type    = A
movetype= H
physics = N
ctrl = 0
anim = 7131

[State 7131, 1]
type = VelAdd
trigger1 = StateType = A
y = .44

[State 7131, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7131, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7131, 4]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 7131, 5]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7132

;---------------------------------------------------------------------------
; HIT_LAND
[Statedef 7132]
type    = S
movetype= H
physics = N
velset = 0,0
ctrl = 0
anim = 7112

[State 7132, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 7132, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7132, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7131, 4]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 7132, 5]
type = ChangeState
trigger1 = Time = 30
value = 7120 + 30*(RoundState != 2)

;---------------------------------------------------------------------------
; Mappy Dead
[Statedef 7140]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
anim = 7140

[State 7140, 1]
type = VelAdd
trigger1 = Time >= 144
y = .44

[State 7140, 2]
type = PlaySnd
trigger1 = Time = 18
value = S7140,0

[State 7140, 3]
type = DestroySelf
trigger1 = Pos Y > 100

;---------------------------------------------------------------------------
;Mappy Win
[Statedef 7150]
type    = S
movetype= I
physics = N
velset = 0
ctrl = 0
anim = 7120
sprpriority = 3

[State 7150, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7150, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7150, 3]
type = VarSet
trigger1 = !Time && ParentDist X <= -30
var(1) = 1

[State 7150, 4]
type = Turn
trigger1 = !Time && ParentDist X <= -30
persistent = 0

[State 7150, 5]
type = VelSet
trigger1 = !Time
x = 2.56*const(size.xscale)

[State 7150, 6]
type = ChangeState
trigger1 = ParentDist X <= -30 && ParentDist X >= -35 && !Var(1)
trigger2 = ParentDist X >= 30 && ParentDist X <= 35 && Var(1)
value = 7151

;---------------------------------------------------------------------------
;Mappy Win
[Statedef 7151]
type    = S
movetype= I
physics = N
velset = 0
ctrl = 0
anim = 7150
sprpriority = 3

[State 7151, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7151, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7151, 4]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7130
time = -1

[State 7151, 5]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7151, 6]
type = ChangeAnim
trigger1 = Anim = 7150 && (root,StateNo = 181 || root,StateNo = 182)
value = 7151

[State 7151, 7]
type = Turn
trigger1 = Anim = 7151 && AnimElem = 2 && root,BackEdgeDist > 10 && Facing = root,Facing
persistent = 0

;---------------------------------------------------------------------------
;Sky Kid (Walk)
[Statedef 7152]
type    = S
movetype= I
physics = N
velset = 2.56,0
ctrl = 0
anim = 7152
sprpriority = 4

[State 7152, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7152, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7152, 3]
type = ParentVarAdd
trigger1 = !Time 
var(13) = Facing

[State 7152, 4]
type = ChangeState
trigger1 = parent,NumHelper(7150) && ParentDist X < 32
trigger2 = parent,NumHelper(7151) && ParentDist X < 64
value = 7153

;---------------------------------------------------------------------------
;Sky Kid (Shrug)
[Statedef 7153]
type    = S
movetype= I
physics = N
velset = 0,0
ctrl = 0
anim = 7153
sprpriority = 4

[State 7152, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7152, 2]
type = PlayerPush
trigger1 = 1
value = 0

;---------------------------------------------------------------------------
;Pac-Man Stand Summon (Entrance)
[Statedef 7200]
type    = S
movetype= I
physics = N
velset = (ParentDist X + 15)/15,-3.33
ctrl = 0
anim = 7200
sprpriority = 3

[State 7200, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7200, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7200, 3]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7200, 4]
type = Null
trigger1 = !Time
var(7) = -50-(50*(root,Var(0) > 0))

[State 7200, 5]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7200, 6]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7200, 7]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7200, 8]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7200, 9]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7200, 10]
type = PlaySnd
trigger1 = !Time
value = S7200,0

[State 7200, 11]
type = Null
trigger1 = !Time && root,Var(6) = 200
value = S7200,1
loop = 1
channel = 5

[State 7200, 11]
type = Null
trigger1 = !Time && root,Var(6) = 100
value = S7200,2
loop = 1
channel = 5

[State 7110, 10]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7201

;---------------------------------------------------------------------------
;Pac-Man Stand Summon (Throw)
[Statedef 7201]
type    = S
movetype= A
physics = N
ctrl = 0
anim = 7201
sprpriority = 3
velset = 0,0

[State 7201, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7201, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7201, 4]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7201, 5]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7201, 12]
type = PosAdd
trigger1 = AnimElem = 4 || AnimElem = 5
x = 4+(6*(AnimElem = 5))

[State 7201, 6]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7201, 7]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7201, 8]
type = PosSet
trigger1 = !Time
y = 0

[State 7201, 9]
type = VelSet
trigger1 = AnimElem = 6
x = 6.8

[State 7200, 10]
type = PlaySnd
trigger1 = AnimElem = 4
value = S7201,0

[State 7201, 10]
type = ChangeState
trigger1 = !AnimTime
value = 7202

;---------------------------------------------------------------------------
;Pac-Man Stand Summon (wakka)
[Statedef 7202]
type    = S
movetype= A
physics = N
velset = 6.8,0
ctrl = 0
anim = 7202
sprpriority = 3

[State 7202, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7202, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7202, 3]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7202, 4]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7201, 6]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7201, 7]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7202, 5]
type = PlaySnd
trigger1 = !Time && root,Var(6) = 300
value = S7202,0
loop = 1
channel = 5

[State 7202, 6]
type = PlaySnd
trigger1 = !Time && root,Var(6) = 200
value = S7202,1
loop = 1
channel = 5

[State 7202, 7]
type = PlaySnd
trigger1 = !Time && root,Var(6) = 100
value = S7202,2
loop = 1
channel = 5

[State 7202, 8]
type = StopSnd
trigger1 = FrontEdgeDist < -40
channel = 5

[State 7203, 11]
type = Helper
trigger1 = AnimElem = 1
name = "Mouth"
ID = 7204
stateno = 7204
pos = 0,0
postype = P1
facing = 1
ownpal = 1
persistent = 0

[State 0, ChangeState]
type = ChangeState
trigger1 = Cond(NumHelper(7204),helper(7204),MoveHit,0)
value = 7203
ignorehitpause = 1

[State 7202, 9]
type = ChangeState
trigger1 = FrontEdgeDist < -40
value = 7300

;---------------------------------------------------------------------------
;Pac-Man Stand Summon (WAKKA)
[Statedef 7203]
type    = S
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 1
sprpriority = 3

[State 7203, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7203, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7203, 3]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7203, 4]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7203, 5]
type = StopSnd
trigger1 = !Time
channel = 5

[State 7203, 6]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7203, 7]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7203, 8]
type = PlaySnd
trigger1 = !Time
value = S7203,0

[State 7203, 9]
type = ChangeState
trigger1 = Time = 41
value = 7202

;---------------------------------------------------------------------------
;Pac-Man Stand Summon (Land)
[Statedef 7204]
type    = S
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 7204
sprpriority = 3

[State 7204, 1]
type = BindToParent
trigger1 = 1
time = 1
pos = 0,0

[State 7204, 2]
type = HitDef
trigger1 = !Time
attr = S, SA
damage = ceil(100*root,fvar(21)),25
animtype = Hard
getpower = 0,0
givepower = 0,0
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 1,1
sparkno = -1
sparkxy = 0,0
hitsound = -1
guardsound = F6, 0
ground.type = Low
guard.slidetime = 18
guard.hittime = 18
ground.velocity = -4.6*const(size.xscale)
ground.cornerpush.veloff = 0
air.type = Low
air.hittime = 100
air.velocity = -3.1*const(size.xscale), -2.2*const(size.yscale)
fall.recover = 0
fall.recovertime = 1
p1stateno = 7205
id = 7200
chainID = -1
nochainID = -1
kill = 0
guard.kill = 1
fall.kill = 1
numhits = 1

[State 7204, 3]
type = PlaySnd
trigger1 = !NumTarget && MoveHit = 1
value = F5,2
ignorehitpause = 1

[State 7204, 4]
type = Explod
trigger1 = !NumTarget && MoveHit = 1
anim = 6001
ID = 7205
pos = 0,-20
postype = P1
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 999
ontop = 1
ownpal = 1

[State 7204, 5]
type = DestroySelf
trigger1 = parent,StateNo != [7202,7203]

;---------------------------------------------------------------------------
;Pac-Man Stand Summon (Land)
[Statedef 7205]
type    = A
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 1
sprpriority = 3

[State 7205, 1]
type = Null
triggerall = !Time
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)

[State 7205, 2]
type = TargetState
trigger1 = !Time
value = 7207
ignorehitpause = 1

[State 7205, 3]
type = Explod
trigger1 = !Time
anim = 7205
ID = 7205
pos = 0,-20
postype = P2
facing = -1*Facing
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = 3
ontop = 1
ownpal = 1
ignorehitpause = 1

[State 7205, 4]
type = ChangeAnim
trigger1 = Anim = 1 && Time = 40
value = 7207

[State 7205, 5]
type = VelSet
trigger1 = Time = 40
y = -7.6

[State 7205, 6]
type = BindToTarget
trigger1 = Time >= 40
time = 1
pos = 0, 0, Mid

[State 7205, 7]
type = VelAdd
trigger1 = Time >= 40
y = .44

[State 7207, 8]
type = ChangeAnim
trigger1 = Anim = 7207 && Vel Y > 0
value = 7208

[State 7207, 7209]
type = ChangeState
trigger1 = Anim = 7208 && Vel Y > 0 && Pos Y > -Vel Y
value = 7206

;---------------------------------------------------------------------------
;Pac-Man Stand Summon (Land)
[Statedef 7206]
type    = A
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 1
sprpriority = 3

[State 7206, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 7206, 2]
type = TargetState
trigger1 = !Time
value = 7209

[State 7206, 3]
type = DestroySelf
trigger1 = !NumTarget

;---------------------------------------------------------------------------
;P2 Chomped
[Statedef 7207]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = 3

[State 7205, 1]
type = ChangeAnim2
trigger1 = 1
value = 1

[State 7205, 2]
type = AssertSpecial
trigger1 = 1
flag = Invisible

[State 7205, 3]
type = ChangeState
trigger1 = Time = 40
value = 7208
;---------------------------------------------------------------------------
;P2 Fly
[Statedef 7208]
type    = A
movetype= H
physics = N
velset = 0,-7.6
ctrl = 0
sprpriority = 3

[State 7207, 1]
type = ChangeAnim2
trigger1 = 1
value = 1

[State 7207, 2]
type = AssertSpecial
trigger1 = 1
flag = Invisible

[State 7207, 3]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
;---------------------------------------------------------------------------
;P2 Fly
[Statedef 7209]
type    = A
movetype= H
physics = N
ctrl = 0
sprpriority = 3

[State 0, ChangeState]
type = SelfState
trigger1 = !Time
value = 5810

;---------------------------------------------------------------------------
;Pac-Man Crouch Summon (Entrance)
[Statedef 7210]
type    = S
movetype= I
physics = N
velset = (ParentDist X)/15,-3.33
ctrl = 0
anim = 7200
sprpriority = 3

[State 7200, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7200, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7200, 3]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7200, 4]
type = Null
trigger1 = !Time
var(7) = -50-(50*(root,Var(0) > 0))

[State 7200, 5]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7200, 6]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7200, 7]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7200, 8]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7200, 9]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7200, 10]
type = PlaySnd
trigger1 = !Time
value = S7200,0

[State 7110, 11]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7211

;---------------------------------------------------------------------------
;Pac-Man Crouch Summon (Throw)
[Statedef 7211]
type    = S
movetype= A
physics = N
ctrl = 0
anim = 7211
sprpriority = 3
velset = 0,0

[State 7211, 1]
type = Helper
trigger1 = AnimElem = 4
name = "Power Pellet"
ID = 7210
stateno = 7215
pos = ceil(2*const(size.xscale)),ceil(-72*const(size.yscale))
postype = p1
facing = 1
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 7211, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7211, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7211, 4]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7211, 5]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7211, 6]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7211, 7]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7201, 8]
type = VelSet
trigger1 = AnimElem = 7
x = -2.1*const(size.xscale)
y = -3.2*const(size.yscale)

[State 7201, 9]
type = VelAdd
trigger1 = Time >= 29
y = .44*const(size.yscale)

[State 7201, 10]
type = StateTypeSet
trigger1 = AnimElem = 7
statetype = A

[State 7201, 11]
type = PlaySnd
trigger1 = AnimElem = 4
value = S7211,0

[State 7201, 12]
type = PlaySnd
trigger1 = AnimElem = 5
value = S7211,1

[State 7201, 13]
type = StopSnd
trigger1 = !Time
channel = 5

[State 7201, 14]
type = PosSet
trigger1 = !Time
y = 0

[State 7201, 15]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7212

;---------------------------------------------------------------------------
;Pac-Man Stand Summon (Land)
[Statedef 7212]
type    = S
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 7212
sprpriority = 3

[State 7202, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7202, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7202, 3]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7202, 4]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7202, 5]
type = PosSet
trigger1 = !Time
y = 0

[State 7202, 6]
type = ChangeState
trigger1 = !AnimTime
value = 7220

;---------------------------------------------------------------------------
;Power Pellet
[Statedef 7215]
type    = A
movetype= I
physics = N
ctrl = 0
anim = 7215
velset = 0,0

[State 7215, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7215, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7215, 3]
type = PosAdd
trigger1 = Time = 15
x = 16*const(size.xscale)
y = 12*const(size.yscale)

[State 7215, 4]
type = VelSet
trigger1 = Time = 15
x = 2.6*const(size.xscale)
y = -3.2*const(size.yscale)

[State 7215, 5]
type = VelAdd
trigger1 = Time >= 15 && StateType = A 
y = .44*const(size.yscale)

[State 7215, 6]
type = StateTypeSet
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
statetype = S

[State 7215, 7]
type = PosSet
trigger1 = Pos Y > 0
y = 0

[State 7215, 8]
type = VelSet
trigger1 = Pos Y >= 0
x = 0
y = 0

[State 7215, 9]
type = ChangeState
trigger1 = (root,Pos X >= Pos X - 10) && (root,Pos X <= Pos X + 10)
trigger1 = (root,Pos Y >= Pos Y - 14) && (root,Pos Y <= Pos Y + 30)
trigger1 = Time > 15
value = 7216

[State 7215, 10]
type = DestroySelf
trigger1 = Time = 100
trigger2 = parent,StateNo != 7211 && Time < 15

;---------------------------------------------------------------------------
;Power Pellet (Collected)
[Statedef 7216]
type    = A
movetype= I
physics = N
ctrl = 0
anim = 1
velset = 0,0

[State 7216, 1]
type = PlaySnd
trigger1 = Time % 8 = 0 
value = S7213,0
channel = 5
ignorehitpause = 1

[State 7216, 2]
type = AssertSpecial
trigger1 = 1
flag = nomusic

[State 7216, 3]
type = DestroySelf
trigger1 = Time = 100

;---------------------------------------------------------------------------
;Pac-Man Leave
[Statedef 7220]
type    = S
movetype= I
physics = N
velset = -2.86*const(size.xscale)
ctrl = 0
anim = 7220
sprpriority = 3

[State 7220, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7220, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7220, 3]
type = NotHitBy
trigger1 = 1
value = SCA
time = -1

[State 7220, 4]
type = Turn
trigger1 = !Time

[State 7200, 5]
type = PlaySnd
trigger1 = (Time % 20) = 0 && root,Var(6) = 300
value = S7202,0
channel = 5

[State 7200, 6]
type = PlaySnd
trigger1 = (Time % 16) = 0 && root,Var(6) = 200
value = S7202,1
channel = 5

[State 7200, 7]
type = PlaySnd
trigger1 = (Time % 14) = 0 && root,Var(6) = 100
value = S7202,2
channel = 5

[State 7220, 8]
type = ChangeState
trigger1 = FrontEdgeDist < -40
value = 7300

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 7230]
type    = A
movetype= H
physics = N
ctrl = 0
anim = 7230
velset = -2.78*const(size.xscale),-3.67*const(size.yscale)

[State 7230, 1]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7230, 2]
type = ParentVarAdd
trigger1 = !Time 
var(6) = -100
ignorehitpause = 1

[State 7230, 3]
type = PlaySnd
trigger1 = !Time
value = S7230,0

[State 7201, 4]
type = StopSnd
trigger1 = !Time
channel = 5

[State 7230, 5]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 1

[State 7230, 6]
type = ChangeState
trigger1 = root,Var(6) = 0
value = 7240

[State 7230, 7]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7231

;---------------------------------------------------------------------------
;Pac-Man Stand Summon (Land)
[Statedef 7231]
type    = S
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 7212
sprpriority = 3

[State 7202, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7202, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7202, 3]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7202, 4]
type = NotHitBy
trigger1 = 1
value = SCA
time = -1

[State 7202, 5]
type = PosSet
trigger1 = !Time
y = 0

[State 7202, 6]
type = ChangeState
trigger1 = !AnimTime
value = 7220
;---------------------------------------------------------------------------
;Pac-Man Dead
[Statedef 7240]
type    = A
movetype= H
physics = N
ctrl = 0
anim = 7240
velset = 0,0

[State 7240, 1]
type = Null
trigger1 = AnimElem = 2
value = S7240,0

[State 7230, 2]
type = PlaySnd
trigger1 = AnimElem = 2
value = S7240,0

[State 77240, 3]
type = DestroySelf
trigger1 = !AnimTime

;---------------------------------------------------------------------------
;Helper Gone
[Statedef 7300]
type    = U
movetype= H
physics = N
ctrl = 0
anim = 1
velset = 0,0
sprpriority = 3

[State 7300, 1]
type = ParentVarSet
trigger1 = Var(11) = Var(10)
var(39) = 0
ignorehitpause = 1

[State 7300, 2]
type = ParentVarSet
trigger1 = !Time
var(38) = 0
ignorehitpause = 1

[State -2, Debug]
type = DisplaytoClipboard
trigger1 = 1
text = "Vel: x = %d y = %d"
params = Var(10), Var(11)
ignorehitpause = 1

[State 7300, 4]
type = DestroySelf
triggerall = !(root,Var(38)) && !(root,Var(39))
trigger1 = !NumTarget && Anim = 1
trigger2 = NumTarget && Anim = 1
trigger2 = target,StateType = L

;---------------------------------------------------------------------------
;Fruit
[Statedef 7400]
type    = A
movetype= I
physics = N
ctrl = 0
anim = 7400+random%8
velset = 0,0
sprpriority = -3

[State 7400, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7400, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7400, 3]
type = PosAdd
trigger1 = Time = 15
x = 16*const(size.xscale)
y = 12*const(size.yscale)

[State 7400, 4]
type = VelSet
trigger1 = Time = 15
x = 2.6*const(size.xscale)
y = -3.2*const(size.yscale)

[State 7400, 5]
type = VelAdd
trigger1 = Time >= 15 && StateType = A 
y = .44*const(size.yscale)

[State 7400, 6]
type = StateTypeSet
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
statetype = S

[State 7400, 7]
type = PosSet
trigger1 = Pos Y > 0
y = 0

[State 7400, 8]
type = VelSet
trigger1 = Pos Y >= 0
x = 0
y = 0

[State 7400, 9]
type = AssertSpecial
trigger1 = Time >= 70 && (GameTime % 2) = 0
flag = invisible

[State 7400, 10]
type = VarSet
trigger1 = 1
var(1) = Anim

[State 7400, 11]
type = ChangeState
trigger1 = (root,Pos X >= Pos X - 10) && (root,Pos X <= Pos X + 10)
trigger1 = (root,Pos Y >= Pos Y - 14) && (root,Pos Y <= Pos Y + 30)
trigger1 = Time > 15
value = 7401

[State 7400, 12]
type = DestroySelf
trigger1 = Time = 100
trigger2 = parent,StateNo != 7201 && Time < 15

;---------------------------------------------------------------------------
;Fruit
[Statedef 7401]
type    = A
movetype= I
physics = N
ctrl = 0
anim = 1
velset = 0,0

[State 7401, 1]
type = VarSet
trigger1 = !Time
var(2) = 1

[State 7401, 2]
type = VarSet
trigger1 = Time = 1
var(2) = 0

[State 7401, 3]
type = Explod
trigger1 = !Time 
anim = Var(1) + 10
ID = 7300
pos = 0,-8*const(size.yscale)
postype = p1
removetime = 48
pausemovetime = 0
scale = 1,1
sprpriority = -3
ownpal = 1

[State 7401, 4]
type = PlaySnd
trigger1 = !Time
value = S7301,0

[State 7201, 13]
type = StopSnd
trigger1 = !Time
channel = 5

[State 7400, 5]
type = DestroySelf
trigger1 = Time = 10